///////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
#include <Config.h>
#include <File/File.h>

//-----------------------------------------------------------------------------

std::string		File::GetFilename()
{
	return m_filename;
}

//-----------------------------------------------------------------------------

std::string		File::ReadLine()
{
	std::string line;
	line.clear();

	char c;
	bool eol = false;
	char eol_char = 0;

	while(!IsEOF())
	{
		Read( &c, sizeof( char ), 1 );
		if( c != '\r' && c != '\n' )
		{
			if( eol )
			{
				Seek( -1, SEEK_CUR );
				break;
			}
			line = line + c ;
		}
		else
		{
			if( eol_char == 0 )
			{
				eol_char = c;
			}
			else if( eol_char == c )
			{
				if( !IsEOF( ) )
				{
					Seek( -1, SEEK_CUR );
				}
				break;
			}
			else
			{
				break;
			}
			eol = true;
		}
	}

	return line;
}

//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
